perm filename S0[F8,ALS] blob
sn#310382 filedate 1977-10-19 generic text, type C, neo UTF8
COMMENT ā VALID 00003 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 Status as of October 18, 1977
C00014 00003 * RAM and SCRATCHPAD assignments. Multiple jumps
C00025 ENDMK
Cā;
Status as of October 18, 1977
The code that follows is divided into 2 portions S1 which contains all
of to major sections needed to interface the checker program proper to the
machine, and S2 which contains the more strictly checkers portions of the
code. At the present time S1 is reasonably debugged although some coding
has yet to be done to allow for unzoomed messages with the zoomed presentation
of the checkers board itself, and the joystick operations are still far from
completely satisfactory. Only a bare start has been made at the debiugging
S2. The code as written occupies about 3 1/2 K and there is no doubt that
every thing can be fit into the alloted 4 K.
General Remarks
We have planned three levels of play which are personified by calling them
Robot Tom, Robot Dick and Robot Harry. Robot Tom will be the weakest
player. The single letters T, D and H will be used to designate these
players. Depending upon what is decided as to the amount of audio and
visual text that can be generated, these three levels might be further
identified by calling the lowest level "Helpful Robot Tom", the next as
"Silent Robot Dick" and the highest level as "Mighty Robot Harry", and the
board could be displayed in diffrent colors for the three different
levels. Some thought has also been given to possible having various
sound effects associated with play against Tom.
Under normal circumstances, the details of how these levels are adjusted
will be kept from the player. He is simply asked to indicate his
preference by typing a T, D, or H, with any other character (including the
space bar) being taken as indicating Tom by default. In fact, all
questions will have a default answer so that a very young child can be
instructed to hit the space bar each time a question is asked until the
board appears and then to make his move. The literate player will be
advised to start with Tom and to progress to Dick and then to Harry as
desired.
A second question will relate to which side is to play first and again
any key other than a specified one will mean that the player wants to play
first. If the player's choice is to play first, then the black pieces
will appear at the bottom of the screen, othewise the red pieces will be
at the bottom. That is, the player's pieces will always be at the bottom
and the standard checker convention of black playing first will thus be
automatically enforced.
The levels of play are set by changes to the depth of ply to which
the search is allowed to go.
For the truly expert checker player, there should be a way to set the
play to even higher levels. Actually, this will not be difficult to do
but unfortunately the playing time may be unduely long, and it probably
would be unwise to let the casual user get into trouble by making these
levels readily available. The good checker player might welcome this
provision.
The user could be advised of this possibility in the literature supplied
with the cartridge and could be told to write in for information as to how
this is done. This could be used to generate a list of interested users
for a mailing list. These people would be prime candidates for other
cartridges and perhaps for a new model of the Video Brain when one is
developed.
It would also be possible to allow the user to set up any initial board
conditions that he choses, (a checker puzzle for example) rather than
having to start each game from scratch. Even the casual user might like
this feature as it would allow him to stop playing in the middle of a game
and to continue the interrupted game as a later time. To make this easy
to do the program should be able to list the board condition in standard
checker notation (so the user can copy it) rather than forcing the user to
generate this list himself or forcing him to make a picture of the board.
If the machine is to play black on starting a new game then 7 possible
first moves will be available in condensed form and a random choice is
made. Condensed tables are to be stored so that the machine can make a
random choice for its first reply to a player's move from 4 stored book
replies. These provisions will insure that each game will have a high
probability of differing from previous games. An astute player can note
the machine play, and thus acquire a repertoire of good first replies.
Piece representation
King's crown Red piece Black piece Cursor
________ ________ ________ ________
| | | | | | |xx |
| x xx x | | | | | |xx |
| xxxx | | | | | |xx |
| xx | | | | | | |
| | | xxxx | | xxxx | | |
| | | xxxxxx | | x x | | |
| | | xxxxxx | | x x | | |
| | | xxxxxx | | x x | | |
| | | xxxx | | xxxx | | |
|________| |________| |________| |________|
The x's indicate red.
The King's crown is the same for both red and black pieces and
is put in the space above the piece.
The cursor is moved by a joy stick and can be positioned anywhere within
the confines of the checker board. The button associated with the joystick
is used to signal that a piece or a square has been selected by the player.
Move verification
When the program has made its move and reported this to the player, it
proceeds at once to compute all possible move available to the player.
When the player points to the piece he wants to move it will be then
possible to test at once as to whether this piece can in fact move. If it
cannot some sort of signal will be given, perhaps a buzz, while if it can
move a blinging spot will appear in the upper left corner of the selected
square from which the piece is to move.
The player will then move the pointer to the square to which he wishes to
move the piece and again the validity of this destination will be checked.
Appropiate messages will advise the player of any incorrect responses which
he may make.
* RAM and SCRATCHPAD assignments. Multiple jumps
Tree data will be kept in RAM in blocks of 16 bytes, one for each ply
depth.
These data will occupy 256 bytes starting at a location DLOC which is
presently defined as H'0E10', thst is in locations H'0E10' thru H'0F0F'.
At the start of a game the first two blocks will be
loaded with the conditions that relate to a game with the machine playing
BLACK. If the player elects to play BLACK then the board conditions after
his move are loaded into the second block. Thereafter the second block
will be used as the board to start the tree search and the machines reply
will be returned in the first block.
Data within each block will be located as follows:
Bytes Contents
0 thru 3 ACTIVE pieces
4 thru 7 PASSIVE pieces
8 thru 11 KINGS
12 MOVE byte
13 Piece debit (3), JUMP (1), Byte # (2), Direction (2).
14 Score, Active's material advantage.
15 Score, Active's positional advantage and Ply debit
When blocks of data are to be operated on, they are moved from RAM into 16
Scratchpad registers starting at a location defined by LISU PLOC where
PLOC is presently defined to be 3 (that is registers 24 thru 39).
The piece debit is given special treatment, since two debits must be
carried forward, that for the active side and that for the passive side.
Since the sides will be reversed when the SC is put back into RAM, the
piece debit in SC is gotten from the previous block, not the current one
from which the rest of the data is gotten. The piece debit in SC thus
refers to the current passive side while thAt in RAM refers to the active
side. The debit account in SC is increased by 1 for each promotion made
by the active side and increased by 2 for each piece captured and 3 for
each king captured. At the start of each play, the piece debit records
for the board record from which the player moves and the resulting board
from which the machine plays will be normallized by subtracting the
smaller value fron both records, and by limiting the maximum value to 3.
During the tree search the maximum value also be limited to 7 to permit
packing in 3 bits.
A similar situation exists as to the score since two sets of scores are
needed for alpha-beta pruning. Here also the scores that are brought
forward as one goes along the tree are gotten from the previous board.
The FIND routine is then entered and at that time all possible moves are
determined, the count of the number of moves is accumulated in SC 2.
If the decision is made to go forward, this value is transfered to SC 7,
**** 7 will be used for something else
overwriting the value saved at the earlier board. If, on the contrary,
the decision is to evaluate then the value is retained in SC 2 only so
that the value in SC 7 is not distroyed.
The other data gotten by the FIND routine, namely the first found MOVE
byte and a record of its J value, its Byte # and its Direction is written
back into the current RAM block.
Scratchpad registers defined by LISU ELOC where ELOC is presently set at 5
are used for EMPTY as created by code EMPT with O'50' and O'57' left blank
as guards.
Scratchpad registers O'57' THRU O'67' are presently unassigned.
Scratchpad registers O'70' thru O'77' are used for a push-down stack, to
be used for nesting subroutines to a maximum depth of 3.
After processing the data in SC is moved back to RAM in the next block with
the ACTIVE and PASSIVE pieces reversed in position.
Scratchpad registers 0 thru 8 are normally used as follows:
Register Usage
0 general purpose
1 general purpose
2 King move flag during SELECT and MOBILITY during FIND
3 Move byte during generation
4 Byte pointer (bits 2 and 3 from FLAG byte, shifted right by 2)
5 Byte identification 0 thru 4, piece debit in 5 thru 7
6 MOVE bit extracted from MOVE
7 Color of ACTIVE (0 if Black, H'FF' if White)
8 Reserved for dumping AC before UPDAT
Data from RAM is transfered into scratchpad registers starting at LISU
PLOC with ACTIVE and PASSIVE have an LISU address of PLOC, while KINGS and
special data have an LISU address of KLOC. The empty squares on the board
are computed fresh each time a board is under study and are stored with an
LISU of ELOC.
Multiple-jump provisions
Multiple jumps pose a special problem, particularly if they are forked.
It seems unwise to provide the space on every move to keep the necessary
information in the remote possibility that it might be a multiple jump.
So some depth of ply is sacrificed when multiple jumps are encountered
to leave the necessary space.
When a jump move is encountered we anticipate a possible continuing jump
and store the resulting board (after the first jump) in the next two
blocks, in the first of these in regular form for use if the jump should
not continue, and in the second of these without reversing the sides so
that the previously active side is still active. An attempt is then made
to find a continuation from this second with the moving piece restricted
to the one participating in the first jump. Incidentally, if the first
jump should cause the piece to arrive at its king row and if the piece
were not already a king then the piece is promoted and no preparaations
for continuing need be made.
If a continuing jump is found then this fact is signalled by storing a
flag in the otherwise unused right half of the MOBS byte associated with
the second block and the space normally used for the MOVE byte and the
direction pointer in the first of the two new blocks is used to save the
identification of the moving piece. The tree analysis then continues from
the second block. On back-up a test must always be made of the flag in
MOBS space and appropiate action taken if it is set. This action involves
looking for a forked jump continuation fron this point and if one is not
found in backing up two blocks to then look for a remaining move from
this earlier board.
If no continuation is found, then the code backs up to the first of the
two mentioned blocks and the temporarily used space is over-written with
it usual contents, and the analysis continues from here.
It should be noted that a double jump thus takes the space normally
allotted to 3 levels of ply and so restricts the maximum depth for which
there space along this particular path by 2 levels. For example, an
exchange of double jumps, as sometimes occures, limits the maximum depth
along this path from the usual limit of 13 to 9.